package com.jeesite.modules.digitalize.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jeesite.modules.digitalize.entity.DigitalizeResourceLibrary;
import com.jeesite.modules.digitalize.entity.ResourceLibrary;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * (DigitalizeResourceLibrary)表数据库访问层
 *
 * @author xk
 * @since 2024-01-03 14:31:12
 */
@Mapper
public interface DigitalizeResourceLibraryDao extends BaseMapper<DigitalizeResourceLibrary> {

    List<ResourceLibrary> getChildList(Long id);
    @Select("select * from digitalize_resource_library where id = #{id}")
    DigitalizeResourceLibrary getByIdAndDelStatus(@Param("id") Integer id);
    @Update("update digitalize_resource_library set del_status = #{library.delStatus}" +
            ",parent_id = #{library.parentId}, update_by = #{library.updateBy},update_date = now() where del_batch = #{library.delBatch}")
    void updateByIdAndDelStatus(@Param("library") DigitalizeResourceLibrary library);
    @Update("update digitalize_resource_library set del_status = #{library.delStatus}" +
            ", update_by = #{library.updateBy},update_date = now() where id = #{library.id}")
    void updateDel(@Param("library") DigitalizeResourceLibrary library);
}

